import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MessageNoticeVO, MessageNoticeForm, MessageNoticeQuery } from '@/api/mushcoin/messageNotice/types';

/**
 * 查询TG消息通知列表
 * @param query
 * @returns {*}
 */

export const listMessageNotice = (query?: MessageNoticeQuery): AxiosPromise<MessageNoticeVO[]> => {
  return request({
    url: '/mushcoin/messageNotice/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询TG消息通知详细
 * @param id
 */
export const getMessageNotice = (id: string | number): AxiosPromise<MessageNoticeVO> => {
  return request({
    url: '/mushcoin/messageNotice/' + id,
    method: 'get'
  });
};

/**
 * 新增TG消息通知
 * @param data
 */
export const addMessageNotice = (data: MessageNoticeForm) => {
  return request({
    url: '/mushcoin/messageNotice',
    method: 'post',
    data: data
  });
};

/**
 * 修改TG消息通知
 * @param data
 */
export const updateMessageNotice = (data: MessageNoticeForm) => {
  return request({
    url: '/mushcoin/messageNotice',
    method: 'put',
    data: data
  });
};

/**
 * 删除TG消息通知
 * @param id
 */
export const delMessageNotice = (id: string | number | Array<string | number>) => {
  return request({
    url: '/mushcoin/messageNotice/' + id,
    method: 'delete'
  });
};
